// import com->alibaba->druid->sql->ast->*;
// import com->alibaba->druid->sql->visitor->SQLASTVisitor;

// import java->util->ArrayList;
// import java->util->std::list;

#pragma once

#include <string>
#include <list>

#include "../SQLReplaceable.h"
#include "../SQLName.h"
#include "../SQLStatement.h"
#include "../SQLExpr.h"
#include "../SQLObjectImpl.h"

#include "SQLSelect.h"
#include "SQLTableSource.h"
#include "SQLTableSourceImpl.h"

class SQLASTVisitor;

class SQLWithSubqueryClause_Entry : virtual public SQLTableSourceImpl, virtual public SQLReplaceable
{
public:
  SQLName_list_ptr columns;
  SQLSelect_ptr subQuery;
  SQLStatement_ptr returningStatement;
  SQLExpr_ptr expr;

  SQLWithSubqueryClause_Entry();

  SQLWithSubqueryClause_Entry(string_ptr alias, SQLSelect_ptr select);

  SQLWithSubqueryClause_Entry(string_ptr alias, SQLExpr_ptr expr);
  SHAREDOBJECT(SQLWithSubqueryClause_Entry);

  void cloneTo(SQLWithSubqueryClause_Entry_ptr x);

  BOOL_ptr replace(SQLExpr_ptr expr, SQLExpr_ptr target);

  // SQLWithSubqueryClause_Entry *clone();
  virtual SQLObject_ptr clone();

  SQLExpr_ptr getExpr();

  void setExpr(SQLExpr_ptr expr);

  void accept0(SQLASTVisitor_ptr visitor);

  SQLSelect_ptr getSubQuery();

  void setSubQuery(SQLSelect_ptr subQuery);

  SQLStatement_ptr getReturningStatement();

  void setReturningStatement(SQLStatement_ptr returningStatement);

  SQLName_list_ptr getColumns();

  SQLTableSource_ptr findTableSourceWithColumn(long columnNameHash, string_ptr columnName, int option);

  bool equals(Object_ptr o);

  int hashCode();
};
